﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Obra.CommandLineInterface;

namespace Obra.Test.CommandLine
{
    [TestFixture]
    public class ArgumentParserTester
    {
        [Test]
        public void ShortCommandLineOptions()
        {
            IArgumentParserService service = new ArgumentParserServiceProvider();
            service.Parse(new string[] {
                "-u", "username",
                "-p", "password",
                "-d", @"c:\temp"
            });

            Assert.AreEqual("username", service.UserName);
            Assert.AreEqual("password", service.Password);
            Assert.IsFalse(service.DryRun);
            Assert.AreEqual(@"c:\temp", service.Directory);
        }

        [Test]
        public void LongCommandLineOptions()
        {
            IArgumentParserService service = new ArgumentParserServiceProvider();
            service.Parse(new string[] {
                "--username", "username",
                "--password", "password",
                "--directory", @"c:\temp"
            });

            Assert.AreEqual("username", service.UserName);
            Assert.AreEqual("password", service.Password);
            Assert.IsFalse(service.DryRun);
            Assert.AreEqual(@"c:\temp", service.Directory);
        }
    }
}
